package com.foreveross.fetl.application.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.foreveross.fetl.application.IFlightInfoApplication;
import com.foreveross.fetl.common.application.BaseApplicationImpl;
import com.foreveross.fetl.core.domain.task.FlightInfoEntity;
import com.foreveross.fetl.vo.FlightInfoVO;
@Transactional
@Service("flightInfoApplication")
public class FlightInfoApplicationImpl extends BaseApplicationImpl implements
		IFlightInfoApplication {

	@Override
	public List<FlightInfoVO> listAll() {
		List<FlightInfoVO> results = new ArrayList<FlightInfoVO>();
		List<FlightInfoEntity> list = this.queryChannel2().queryResult("from FlightInfoEntity e", new Object[]{});
		for(FlightInfoEntity e : list){
			results.add(new FlightInfoVO(e));
		}
		return results;
	}

	@Override
	public List<FlightInfoVO> listByCompanyCode(String companyCode) {
		List<FlightInfoVO> results = new ArrayList<FlightInfoVO>();
		List<FlightInfoEntity> list = this.queryChannel2()
				.queryResult("from FlightInfoEntity e where e.companyCode=? order by e.flightNo", 
				new Object[]{companyCode});
		for(FlightInfoEntity e : list){
			results.add(new FlightInfoVO(e));
		}
		return results;
	}

}
